package com.example.webdemo.common;

/**
 * @author zp
 * @version 1.0
 * @description: 返回的统一参数
 * @date 2023/6/24 16:30
 */
public class ResultData {
    private String code;
    private String message;
    private Object data;

    public ResultData(String code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public ResultData() {
    }

    public static ResultData success(){
        return new ResultData("0000","success",null);
    }

    public static ResultData success(Object data){
        return new ResultData("0000","success",data);
    }

    public static ResultData fail(){
        return new ResultData("9999","fail",null);
    }

    public static ResultData fail(String message){
        return new ResultData("9999",message,null);
    }

    @Override
    public String toString() {
        return "ResultData{" +
                "code='" + code + '\'' +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
